package com.wwwarehouse.usercenter.adapter;

import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.wwwarehouse.usercenter.R;
import com.wwwarehouse.usercenter.bean.authoritydistribute.GetFailDetailResponseBean;
import com.wwwarehouse.usercenter.bean.permission_recycle.RetrieveAuthorityBean;

import java.util.List;

/**
 * Created by xiaoke.ni on 2017/10/17.
 */

public class PRUncollectedDetailAdapter extends RecyclerView.Adapter<PRUncollectedDetailAdapter.PRUncollectedDetailAdapterHolder> {

    private List<RetrieveAuthorityBean.DetailsBean>  mDataList;

    public PRUncollectedDetailAdapter(List<RetrieveAuthorityBean.DetailsBean> dataList) {
        this.mDataList = dataList;
    }

    @Override
    public PRUncollectedDetailAdapter.PRUncollectedDetailAdapterHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_rv_detail_auth_distribute, parent, false);
        return new PRUncollectedDetailAdapter.PRUncollectedDetailAdapterHolder(view);
    }

    @Override
    public void onBindViewHolder(PRUncollectedDetailAdapter.PRUncollectedDetailAdapterHolder holder, int position) {
        RetrieveAuthorityBean.DetailsBean listBean = mDataList.get(position);

        holder.mTvAuthName.setText(listBean.getUserName());
        holder.mTvReason.setText(listBean.getFaileReason());
        // process data
    }

    @Override
    public int getItemCount() {
        return mDataList == null ? 0 : mDataList.size();
    }

    static class PRUncollectedDetailAdapterHolder extends RecyclerView.ViewHolder {

        TextView mTvReason;
        TextView mTvAuthName;

        public PRUncollectedDetailAdapterHolder(View itemView) {
            super(itemView);
            mTvAuthName = (TextView) itemView.findViewById(R.id.tv_authName);
            mTvReason = (TextView) itemView.findViewById(R.id.tv_detail_msg);
        }
    }
}
